﻿using System;
using Event.EventBus;

namespace Event.Authentication.EventBusPattern
{
    public class SearchEngineService : IObservedService
    {
        private readonly UserService _userService;
        private readonly IMessenger _messenger;

        public SearchEngineService(UserService userService, IMessenger messenger)
        {
            _userService = userService;
            _messenger = messenger;
        }

        public void RegisterSubject()
        {
            _messenger.Register<UserRegisteredMessage>(_userService, Insert);
        }

        public void Insert(UserRegisteredMessage user)
        {
            Console.WriteLine("Insert into search engine");
        }
    }

}